<script type="text/javascript">
function submitform(){
  jConfirm('你确定立即保存吗?','请确定',function(res){
      if(res==true){
          saveForm();
      }
  });
  return false;
}

//保存当前form
function saveForm(){
    var objData = {};
  
  //获取表单数据
  var inputLength = $(".wiki-meta input").length;
  for( var i = 0; i < inputLength; i++ ){
    var name = $(".wiki-meta input:eq("+i+")").attr('name');
    var value = $(".wiki-meta input:eq("+i+")").val();
    objData[name] = value;
  }
  
  objData.description = $('textarea[name=description]').val();//特例，textarea数据
  $.ajax({
     'url' : "insert",
     'type' : 'POST',
     'data' : objData,
     'success' : function(data){
       if( data=='Success' ){
         $(".info p").html("恭喜您,操作成功！");
         $("#message-box").slideDown('slow');
         setTimeout(function(){$('#message-box').slideUp('slow');},3000);//三秒自动关闭
       }else{
         $(".error p").html("操作失败,请刷新后重试！");
         $("#message-box").slideDown('slow');
         setTimeout(function(){$('#message-box').slideUp('slow');},3000);
       }
     },
     'error' : function(data){
        $(".error p").html("操作失败,请刷新后重试！");
        $("#message-box").slideDown('slow');
        setTimeout(function(){$('#message-box').slideUp('slow');},3000);
     }
  });
}
</script>
<div id="content">
  <div class="content_inner">
    <header>
      <h2 class="content">网站信息配置</h2>
      <nav class="utility">
        <li class="save"><a href="javascript:;" onclick="javascript:return submitform()">保存</a></li>
      </nav>
    </header>
    <?php include "_flash.php"; ?>
    <div class="widget">
      <?php echo form_open('admin/setting/insert', array('name'=>'adminform')); ?>
                <div class="widget_up" style="margin-bottom:20px;">
                  <h3>基本信息</h3>
                  <div class="widget-body">
                    <ul class="wiki-meta">
                      <li><label>中文网站名:</label><?php echo inputText('siteName', arrayIsset('siteName', $siteSet), 'text') ?></li>
                       <li><label>英文网站名:</label><?php echo inputText('ensiteName', arrayIsset('ensiteName', $siteSet), 'text') ?></li>
                       <li><label>电子邮件:</label><?php echo inputText('email', arrayIsset('email', $siteSet), 'text') ?></li>
                       <li><label>电话:</label><?php echo inputText('tel', arrayIsset('tel', $siteSet), 'text') ?></li>
                       <li><label>中文地址:</label><?php echo inputText('address', arrayIsset('address', $siteSet), 'text') ?></li>
                       <li><label>英文地址:</label><?php echo inputText('enaddress', arrayIsset('enaddress', $siteSet), 'text') ?></li>
                       <li><label>联系人:</label><?php echo inputText('contact', arrayIsset('contact', $siteSet), 'text') ?></li>
                       <li><label>英文联系人:</label><?php echo inputText('encontact', arrayIsset('encontact', $siteSet), 'text') ?></li>
                       <li><label>关键字:</label><?php echo inputText('keywords', arrayIsset('keywords', $siteSet), 'text') ?></li>
                       <li><label>传真:</label><?php echo inputText('fax', arrayIsset('fax', $siteSet), 'text') ?></li>
                       <li><label>备案号:</label><?php echo inputText('icp', arrayIsset('icp', $siteSet), 'text') ?></li>
                       <li>
                         <label>网站描述:</label>
                         <?php echo textareaText('description', arrayIsset('description', $siteSet)) ?>
                       </li>
                       
                    </ul>
                  </div>
  </div>
</div>
  </div></div>

